Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
A cored, fixed, documented and optimized version of the popular `colors.js`: Get colors in your node.js console like what...
A cored, fixed, documented and optimized version of the popular colors.js. Can be used as a drop-in replacement, also works correctly in the browser, provides a CSS mode and has been compiled through Closure Compiler using advanced optimizations. Additionally, nearly every issue and pull request on the original has been incorporated.
npm install colour
This package extends the global String prototype with additional getters that apply terminal colors to your texts. Available styles are:
var colour = require('colour');
console.log('hello'.green); // outputs green text
console.log('i like cake and pies'.underline.red) // outputs red underlined text
console.log('inverse the color'.inverse); // inverses the color
console.log('OMG Rainbows!'.rainbow); // rainbow (ignores spaces)
colors
var /* just name it */ colors = require('colour');
...
Its also possible to define your own themes by creating new getters on the String object. Example:
var colour = require('colour');
colour.setTheme({
silly: 'rainbow',
input: 'grey',
verbose: 'cyan',
prompt: 'grey',
info: 'green',
data: 'grey',
help: 'cyan',
warn: ['yellow', 'underline'], // Applies two styles at once
debug: 'blue',
error: 'red bold' // Again, two styles
});
console.log("this is an error".error); // outputs bold red text
console.log("this is a warning".warn); // outputs underlined yellow text
console.log(colour.green("this is green")); // Alternatively
var colour = require('colour');
...
colour.mode = 'none'; // No colors at all
colour.mode = 'console'; // Adds terminal colors (default on node.js)
colour.mode = 'browser'; // Adds HTML colors (default in browsers)
colour.mode = 'browser-css'; // Adds special CSS (see examples/example.css)
If you have a reason to use a fresh String prototype in your application, you may also revert all extensions made.
var colour = require('colour');
...
colour.uninstall(); // Removes all custom properties from the String prototype
...
colour.install(); // Re-installs them
...
Based on work started by Marak (Marak Squires), cloudhead (Alexis Sellier), mmalecki (Maciej Małecki), nicoreed (Nico Reed), morganrallen (Morgan Allen), JustinCampbell (Justin Campbell) and ded (Dustin Diaz).
The MIT-License (MIT)
FAQs
A cored, fixed, documented and optimized version of the popular `colors.js`: Get colors in your node.js console like what...
The npm package colour receives a total of 122,806 weekly downloads. As such, colour popularity was classified as popular.
We found that colour demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.